02. Introduction to NumPy

Introduction to NumPy

NumPy stands for Numerical Python and it's a fundamental package for scientific computing in Python. NumPy provides Python with an extensive math library capable of performing numerical computations effectively and efficiently. These lessons are intended as a basic overview of NumPy and introduces some of its most important features.

In the following lessons you will learn:

  • How to import NumPy
  • How to create multidimensional NumPy ndarrays using various methods
  • How to access and change elements in ndarrays
  • How to load and save ndarrays
  • How to use slicing to select or change subsets of an ndarray
  • Understand the difference between a view and a copy an of ndarray
  • How to use Boolean indexing and set operations to select or change subsets of an ndarray
  • How to sort ndarrays
  • How to perform element-wise operations on ndarrays
  • Understand how NumPy uses broadcasting to perform operations on ndarrays of different sizes.

Downloading NumPy

NumPy is included with Anaconda . If you don't already have Anaconda installed on your computer, please refer to the Anaconda section to get clear instructions on how to install Anaconda on your PC or Mac.

NumPy Versions

As with many Python packages, NumPy is updated from time to time. The following lessons were created using NumPy version 1.13.0. You can check which version of NumPy you have by typing !conda list numpy in your Jupyter Notebook or by typing conda list numpy in the Anaconda prompt. If you have another version of NumPy installed in your computer, you can update your version by typing conda install numpy=1.13 in the Anaconda prompt. As newer versions of NumPy are released, some functions may become obsolete or replaced, so make sure you have the correct NumPy version before running the code. This will guarantee your code will run smoothly.

NumPy Documentation

NumPy is a remarkable math library and it has many functions and features. In these introductory lessons we will only scratch the surface of what NumPy can do. If you want to learn more about NumPy, make sure you check out the NumPy Documentation:

NumPy Manual
NumPy User Guide
NumPy Reference
Scipy Lectures